package com.felight.list;

/**
 * ArrayList which accepts Student object is created and sorting is done. 
 */
import java.util.ArrayList;
import java.util.Collections;

public class Test {
	public static void main(String[] args) {
		ArrayList<Student> lst = new ArrayList<Student>();
		Student s1 = new Student("seema", 90); // Student objects are created
		Student s2 = new Student("megha", 85);
		Student s3 = new Student("deepa", 67);
		lst.add(s1); // Student objects are added to list using add() method
		lst.add(s2);
		lst.add(s3);
		extracted(lst); // Sorting is done, where the sort() method
								// internally calls compareTo() method of
								// Student class
		for (Student s : lst) {
			System.out.println(s.perc);
		}

	}

	private static void extracted(ArrayList<Student> lst) {
		Collections.sort(lst);
	}
}
